<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="system.bean.Operation"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>操作管理</title>
	<meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
	<link rel="stylesheet" type="text/css" href="<%=basePath%>/css/index.css" />
	<link rel="stylesheet" type="text/css" href="<%=basePath%>/css/items.css" />
	<link rel="stylesheet" type="text/css" href="<%=basePath%>/css/subItems.css" />
    <script type="text/javascript"  src="<%=basePath%>js/getElementPos.js"></script>
    <script type="text/javascript"  src="<%=basePath%>js/coverLayer.js"></script>
    <script type="text/javascript"  src="<%=basePath%>js/Operation.js"></script>
    <script type="text/javascript"  src="<%=basePath%>jstree-v.pre1.0/_lib/jquery.js"></script>
    <script type="text/javascript"  src="<%=basePath%>js/StringUtil.js"></script>
  </head>
<body>
<script type="text/javascript">
   function bodyLoad(){
   }
   $(document).ready(function(){
        $("#submitButton").click(function(){
	 	     $(":input").css("border-color","");
		     if($("#_title").val().trim().length == 0){
		        $("#_title").css("border-color","red");
		        alert("Title 不能为空！");
		        return;
		     }
		     if($("#_identify").val().trim().length == 0){
		     	$("#_identify").css("border-color","red");
		        alert("Identify 不能为空！");
		        return;
		     }
		     //提交新增操作
		     submitAddOperation();
		});
 	});
</script>
<form id="operationForm" method="post" action="<%=basePath %>AddOperationServlet" class="IndexFormStyle" >
   <div id="TableContent" class="tableContent" >
   	   <div class="itemTitle">
	        新增操作  
	   </div>
	   <div class="itemDiv">
	     <span class="textSpan">&nbsp; Title:</span>
	     <input class="inputText" id="_title" name="_title" value="" />
	   </div>
	   <div class="itemDiv">
	     <span class="textSpan">&nbsp; Identify:</span>
	     <input class="inputText" id="_identify" name="_identify" value="" />
	   </div>
	   <div class="itemDiv">
	   	  <span class="textSpan">&nbsp;htmlStr:</span><br/>
	      <textarea class="textArea"  id="_htmlStr" name="_htmlStr"></textarea>
	   </div>
	   <div class="itemDiv">
	   		<span class="textSpan">&nbsp;comment:</span><br/>
	    	<textarea class="textArea"  id="_comment" name="_comment"></textarea>
	   </div>
   </div>
   <div id="submitContent" class="submitContent">
     <span id="opNoticeSpan" style="color:red;" ></span>
     <span class="textSpan">&nbsp;</span>
     <input type="button" id="submitButton" value="Apply"  />
   </div>
   </form>
   <div class="itemTitle">
	  操作列表  
   </div>
    <div style=" padding:5px;border:1px solid #EAEAEA; margin:5px; "  >
  		<div id="OperationListDiv" style="margin:0px;overflow:auto;max-height:300px;border:1px;border-color:#666;font-size:14px;">
  		  <% ArrayList<Object> list = (ArrayList<Object>)request.getAttribute("List"); %>
  		  <% for(int i = 0 ; i < list.size() ; i++){ %>
  		  <% Operation operation = (Operation)list.get(i); %>
  		   <div style="float:left;width:200px; margin:5px;padding-top:5px; border:1px dotted #CCC;">
  		       <div style="float:left;width:150px;"><%=operation.getTitle() %></div>
  		       <div style="float:left;width:25px;cursor:pointer;"><img onclick="EditOperation(<%=operation.getOperationId() %>,this)" class="buttonBcImg" width="20" src="<%=basePath %>images/edit.jpg" /></div>
  		       <div style="float:left;width:25px;cursor:pointer;"><img onclick="DeleteOperation(<%=operation.getOperationId() %>,this)" class="buttonBcImg" width="20" src="<%=basePath %>images/delete.png" /></div>
  		       <div style="clear:both" ></div>
  		   </div>
  		  <%} %>
  		   <div id="ListDiv_cleanfloat" style="clear:both" ></div>
  		</div>
   </div>
   
   <div id="coverDiv" class="coverDiv"></div> <!-- 覆盖层，要放在所有弹出层之前 -->
   <!-- ********************************* OperationEditContainer Begin******************************************************* -->
  <div id="OperationEditContainer" class="addContenter" style="display:none;">
    <div id="addItem_title"  style="border-bottom:1px solid #666;margin-bottom:8px;" >
        <div id="EditOperation_title" style="float:left; font-weight:bold;">Operation Role</div>
        <div style="float:right;">
            <a href="javascript:void(0);" id="EditOperation_close" title="close">close</a>
        </div>
        <div style="clear:both" ></div>
    </div>
    <div id ="OperationRole_container">
       <div class="itemDiv">
	     <span class="textSpan">&nbsp; Title:</span>
	     <input class="inputText" id="E_title" name="E_title" value="" />
	   </div>
	   <div class="itemDiv">
	     <span class="textSpan">&nbsp; Identify:</span>
	     <input class="inputText" id="E_identify" name="E_identify" readonly="readonly" value="" />
	   </div>
	   <div class="ListItem">
	   		<span class="textSpan">&nbsp; HtmlStr:</span><br/>
	    	<textarea style="width:95%;" class="textArea"  id="E_htmlStr" name="E_htmlStr"></textarea>
	   </div>
	   <div class="ListItem">
	   		<span class="textSpan">&nbsp; Comment:</span><br/>
	    	<textarea style="width:95%;" class="textArea"  id="E_comment" name="E_comment"></textarea>
	   </div>
    </div>
    <div class="submitContainer">
    	<input type="button" value="提交" onclick="submitEditOperation()" />&nbsp;
    	<input type="hidden" id="E_operationId" name="E_operationId" value="" />
    	<input type="button" value="取消" onclick="hidenEditOperation()"  />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	</div>
  </div>  
  <!-- ********************************* OperationEditContainer End******************************************************* -->
</body>
</html>